#include <stdio.h>
#include <stdlib.h>

#include "ast.h"

void TraceTree(ASTTREE tree)
{
	if (tree != NULL) 
	{
									
		printf(";[DEBUG TREE %p] type=%-15s,vtype=%-10s,ival=%d, sval=", tree, humanReadableNodeType(tree->type),humanReadableNodeType(tree->vtype), tree->ival);
		if (tree->sval == NULL) printf("NULL");
		else printf("'%s'", tree->sval);
        printf(",bval=%d, left=%p, right=%p\n",tree->bval, tree->left, tree->right);

		TraceTree(tree->left);
		TraceTree(tree->right);
    }
}
/*void TraceSym(SYMTABLE s)
{
	if (s != NULL)
    {
      if (s->next != NULL)
		{
			printf(";[DEBUG SYMTABLE %p] id=", s);  
			if (s->id == NULL) printf("NULL");
			else printf("'%s'", s->id);
			printf(",location=%d,idType=%s next=%p\n", s->location,humanReadableNodeType(s->idType), s->next);
	  
			TraceSym(s->next);
		}
    }
}*/

void TraceMsg(char * methodName, char * msg)
{
	printf(";[DEBUG-%s] %s\n",methodName,msg);
}

void TraceMsg2(char * methodName, char * msg, char * msg2)
{
	printf(";[DEBUG-%s] %s  | %s\n",methodName,msg, msg2);
}

void TraceNb(char * methodName, int nb)
{
	printf(";[DEBUG-%s] %d\n",methodName, nb);
}